from datetime import datetime


class BlogInfo:
    def __init__(self, search_content: str, blog_id: int, nick_name: str, user_id: int, release_time, 
                 forward_count: int, comment_count: int, like_count: int, content: str):
        self.search_content = search_content          # 搜索内容
        self.blog_id = blog_id                        # 博客ID
        self.nick_name = nick_name                    # 昵称
        self.user_id = user_id                        # 用户ID
        self.release_time = release_time              # 发布时间
        self.forward_count = forward_count            # 转发次数
        self.comment_count = comment_count            # 评论次数
        self.like_count = like_count                  # 点赞次数
        self.content = content                        # 微博的内容

    def __str__(self) -> str:
        info = """
        搜索内容：  %s
        博客ID：   %d
        昵称：     %s
        用户ID：   %d
        发布时间：  %s
        转发次数：  %d
        评论次数：  %d
        点赞次数：  %d
        微博的内容: %s
        """ % (self.search_content, self.blog_id, self.nick_name, self.user_id, self.release_time, 
               self.forward_count, self.comment_count, self.like_count, self.content)
        return info

    def set_comments(self, comment_list: list):
        self.commeny_list = comment_list


class CommentInfo:
    def __init__(self, comment_id: int, father_comment_id: int, blog_id: int,
                nick_name: int, release_time, content: str) -> None:
        self.comment_id = comment_id
        self.father_comment_id = father_comment_id
        self.blog_id = blog_id
        self.nick_name = nick_name
        self.release_time = datetime.strptime(release_time, "%a %b %d %H:%M:%S +0800 %Y")
        self.content = content

    def __str__(self) -> str:
        info = """
        评论ID：\t\t%d
        父评论ID：\t\t%d
        博客ID：\t\t%d
        评论者昵称：\t\t%s
        评论时间：\t\t%s
        评论内容：\t\t%s
        """ % (self.comment_id, self.father_comment_id, self.blog_id, self.nick_name, 
               self.release_time, self.content)
        return info


if __name__ == "__main__":
    pass
    t = "Sun May 15 23:02:37 +0800 2022"
    d = datetime.strptime(t, "%a %b %d %H:%M:%S +0800 %Y")
    print(d)

